import React from 'react';
import axios from 'axios'

class App extends React.Component{
  getStudentData = ()=>{
    axios.get('http://localhost:3000/api1/students').then(
      res => {console.log(res);},
      err => {console.log(err);}
    )
  }

  getCarData = ()=>{
    axios.get('http://localhost:3000/api2/cars').then(
      res => {console.log(res);},
      err => {console.log(err);}
    )
  }

  render(){
    return (
      <div>
        <button onClick={this.getStudentData}>点击发起Ajax请求1</button>
        <button onClick={this.getCarData}>点击发起Ajax请求2</button>
      </div>
    )
  }
}

export default App;
